import {baseUrl} from "./config.js"

export function topList(){
	let listIds = ['19723756','3779629','2884035','3778678']
	return new Promise(function(reslove,reject){
		uni.request({
			url: `${baseUrl}/toplist/detail`,
			method: 'GET',
			data: {},
			success: res => {
				let result = res.data.list
				result.length = 4
				for(var i = 0;i<listIds.length;i++){
					result[i].listid = listIds[i]
				}
				reslove(result)
			},
			fail: () => {},
			complete: () => {}
		});
	})

}

export function List(listid){
	return uni.request({
		url:`${baseUrl}/playlist/detail?id=${listid}`,
		method:"GET"
	})
}

export function songdetail(songid){
	return uni.request({
		url:`${baseUrl}/song/detail?ids=${songid}`,
		method:"GET"
	})
}

export function songlyric(songid){
	return uni.request({
		url:`${baseUrl}/lyric?id=${songid}`,
		method:"GET"
	})
}

export function songurl(songid){
	return uni.request({
		url:`${baseUrl}/song/url?id=${songid}`,
		method:"GET"
	})
}

export function searchhot(){
	return uni.request({
		url:`${baseUrl}/search/hot/detail`,
		method:"GET"
	})
}

export function searchword(keyword){
	return uni.request({
		url:`${baseUrl}/search?keywords=${keyword}`,
		method:"GET"
	})
}

export function searchsuggest(keyword){
	return uni.request({
		url:`${baseUrl}/search/suggest?keywords=${keyword}&type=mobie`,
		method:"GET"
	})
}